package com.example.administrator.xiaobo.adapter.show_adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.administrator.xiaobo.R;
import com.example.administrator.xiaobo.bean.show_6_itemBean;

import java.util.LinkedList;

/**
 * Created by Administrator on 2017/2/9.
 * viewType =  6
 */

public class ShowAdapter3 extends RecyclerView.Adapter<ShowAdapter3.MyViewHolder> {
    private Context context;
    private LinkedList<show_6_itemBean> data;

    public ShowAdapter3(Context context, LinkedList<show_6_itemBean> data) {
        this.context = context;
        this.data = data;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_show0201,null);
        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        holder.textView.setText(data.get(position).name);
        Glide.with(context).load(data.get(position).level1).placeholder(R.drawable.app_empty_icon).error(R.drawable.app_empty_icon).into(holder.imageView);
        Glide.with(context).load(data.get(position).icon_level1).into(holder.icon);
    }

    @Override
    public int getItemCount() {
        return 6;
    }

    public class MyViewHolder extends RecyclerView.ViewHolder{
        ImageView imageView;
        ImageView icon;
        TextView textView;
        public MyViewHolder(View itemView) {
            super(itemView);
            imageView = (ImageView) itemView.findViewById(R.id.imageView_show0201);
            icon = (ImageView) itemView.findViewById(R.id.icon_show0201);
            textView = (TextView) itemView.findViewById(R.id.textView_show0201);
        }
    }
}
